package com.turing.post.organization.util;

import java.math.BigInteger;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.IdClass;
import javax.persistence.Table;

import com.turing.post.util.PCPSUtil;

/**
 * 商圈绑定商户
 * 
 * @author zxp
 * @Jan 3, 2013
 */
@SuppressWarnings("serial")
@Entity
@Table(name = "BusinessDistrictMerchant")
@IdClass(BusinessDistrictMerchant.class)
public class BusinessDistrictMerchant implements java.io.Serializable {
	/**
	 * 商圈ID
	 */
	private BigInteger businessDistrictId;
	/**
	 * 商户NO
	 */
	private String MerchantNo;

	public BusinessDistrictMerchant() {

	}

	@Id
	@Column(name = "BUSINESSDISTRICTID", nullable = false)
	public BigInteger getBusinessDistrictId() {
		return businessDistrictId;
	}

	public void setBusinessDistrictId(BigInteger businessDistrictId) {
		this.businessDistrictId = businessDistrictId;
	}

	@Id
	@Column(name = "MERCHANTNO", nullable = false)
	public String getMerchantNo() {
		return MerchantNo;
	}

	public void setMerchantNo(String merchantNo) {
		MerchantNo = merchantNo;
	}

	public int hashCode() {
		return PCPSUtil.getObjectListHashCode(new Object[] { getMerchantNo(),
				getBusinessDistrictId() });
	}

	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (!(obj instanceof BusinessDistrictMerchant))
			return false;
		BusinessDistrictMerchant other = (BusinessDistrictMerchant) obj;
		if (!PCPSUtil
				.compareObject(this.getMerchantNo(), other.getMerchantNo()))
			return false;

		return PCPSUtil.compareObject(this.getBusinessDistrictId(), other
				.getBusinessDistrictId());
	}
}